exports.UpdateExpenseWindow = function(_id) {		
	
	var dbExpense=require('dbExpense');
	var data = dbExpense.selectItem(_id);
	
	var self = Ti.UI.createWindow({
		modal: true,
		title: 'Update Item',
		backgroundColor: '#fff'
	});
	
	self.addEventListener('focus', function(e) {
		self.currentTab = e.tab;
	});
	
	var nameField = Ti.UI.createTextField({
		width: '300dp',
		height: '45dp',
		top: '20dp',
		value: data.Name,
		borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		returnKeyType: Ti.UI.RETURNKEY_DONE
	});		
		
	var priceField = Ti.UI.createTextField({
		width: '300dp',
		height: '45dp',
		top: '80dp',
		value: data.Price,
		borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		returnKeyType: Ti.UI.RETURNKEY_DONE		
	});
			
	var dateField = Ti.UI.createTextField({
		width: '300dp',
		height: '45dp',
		top: '130dp',
		value: data.Date,
		borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
		returnKeyType: Ti.UI.RETURNKEY_DONE
	});				

	var addButton = Ti.UI.createButton({
		title: 'Add',
		width: '300dp',
		height: '40dp',
		top: '175dp'
	});
	addButton.addEventListener('click', function() {
		dbExpense.updateItem(_id,nameField.value,priceField.value,dateField.value,self);
		Ti.App.fireEvent('app:updateTables');
		self.close();
				
	});
	
	
	var cancelButton = Ti.UI.createButton({
		title: 'Cancel',
		width: '300dp',
		height: '40dp',
		top: '215dp'
	});
	cancelButton.addEventListener('click', function(e) {
		self.close();
	});
	
	self.add(nameField);
	self.add(priceField);
	self.add(dateField);
	self.add(addButton);
	self.add(cancelButton);

	return self;
};

//module.exports = UpdateExpenseWindow;
